package com.josework.springhelloworld.model;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user")
public class User extends Model<User> implements Serializable {

    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;

    @TableField(value = "username")
    private String username;

    @TableField("birthday")
    private LocalDate birthday;

    @TableField("sex")
    private String sex;

    @TableField("address")
    private String address;

    @TableField(value = "addTime",updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.TIMESTAMP)
    private LocalDateTime addTime = LocalDateTime.now();

    @TableField(value = "updateTime",jdbcType = JdbcType.TIMESTAMP)
    private LocalDateTime updateTime;

    @TableField("deleted")
    @TableLogic(value = "0", delval = "1")
    private Boolean deleted = false;

    @TableField("secretKey")
    private String secretKey;

}
